﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace eLoan.Models
{
    public class LoanPaymentModel: SearchModel
    {
        public List<BatchPaymentItem> PaymentItems { get; set; }

        public List<SelectListItem> PaymentTypes { get; set; }

        public bool IsCashPayment { get; set; }

        [Display(Name = "Payment Date")]
        public DateTime PaymentDate { get; set; }

    }

    public class ChequeClearingModel: SearchModel
    {
        public List<ChequeClearingItem> Items { get; set; }

        [Display(Name = "From Date")]
        public DateTime FromDate { get; set; }

        [Display(Name = "To Date")]
        public DateTime ToDate { get; set; }
    }

    public class DuePaymentModel : SearchModel
    {
        public List<DuePaymentItem> DailyDuePaymentItems { get; set; }

        public List<DuePaymentItem> OtherDuePaymentItems { get; set; }

        [Display(Name = "Due Date")]
        public DateTime DueDate { get; set; }

    }

    public class DailyDuePaymentModel : SearchModel
    {
        public List<DailyDuePaymentItem> DailyDuePaymentItems { get; set; }

        public DateTime? FromDate { get; set; }

        public DateTime? ToDate { get; set; }
    }

    public class OtherDuePaymentModel : SearchModel
    {
        public List<OtherDuePaymentItem> OtherDuePaymentItems { get; set; }

        public DateTime? FromDate { get; set; }

        public DateTime? ToDate { get; set; }
    }

    public class SearchModel
    {
        public string SelectedBranchCode { get; set; }

        [Display(Name = "Select a branch")]
        public IEnumerable<SelectListItem> Branches { get; set; }

        public int SelectedAgentID { get; set; }

        [Display(Name = "Select an agent")]
        public IEnumerable<SelectListItem> Agents { get; set; }

        [Display(Name = "Search text")]
        public string SearchText { get; set; }

        public bool IsAdmin { get; set; }
    }

    public class LoansForNotificationModel : BatchPaymentItem
    {
        public bool IsSelected { get; set; }
    }

    public class LoansForRenewalModel : LoanFields
    {
        public string BorrowerName { get; set; }

        public string ContactNumbers { get; set; }

        public string LoanStatus { get; set; }

        public string Remarks { get; set; }

        public bool IsSelected { get; set; }
    }

    public class LoanProspectModel : ProspectFields
    {
        public bool IsSelected { get; set; }
    }

    public class BatchPaymentItem
    {
        [Display(Name = "Document No")]
        public string DocumentNo { get; set; }

        [Display(Name = "Borrower ID")]
        public int BorrowerID { get; set; }

        [Display(Name = "Borrower")]
        public string BorrowerName { get; set; }

        [Display(Name = "Amount")]
        public decimal Amount { get; set; }

        [Display(Name = "Cheque Details")]
        public string ChequeDetails { get; set; }

        [Display(Name = "Outstanding Balance")]
        public decimal OutstandingBalance { get; set; }

        [Display(Name = "Receivable")]
        public decimal Receivable { get; set; }

        [Display(Name = "Total Payment")]
        public decimal TotalPayment { get; set; }

        [Display(Name = "Short / Over")]
        public decimal ShortOver { get; set; }

        [Display(Name = "Penalty")]
        public decimal Penalty { get; set; }

        [Display(Name = "Penalty Balance")]
        public decimal PenaltyBalance { get; set; }

        [Display(Name = "Loan Date")]
        public DateTime DocumentDate { get; set; }

        [Display(Name = "Payment Start Date")]
        public DateTime? PaymentStartDate { get; set; }

        [Display(Name = "Maturity Date")]
        public DateTime? PaymentEndDate { get; set; }

        [Display(Name = "Loan Description")]
        public string LoanTypeDescription { get; set; }

        [Display(Name = "Payment Type")]
        public int PaymentTypeID { get; set; }

        [Display(Name = "Payment Type")]
        public string PaymentTypeName { get; set; }

        [Display(Name = "Contact Numbers")]
        public string ContactNumbers { get; set; }

        [Display(Name = "Loan Status")]
        public string LoanStatus { get; set; }

    }

    public class DuePaymentItem
    {
        public string DocumentNo { get; set; }

        public string BorrowerName { get; set; }

        public int ProceedTypeID { get; set; }

        public string ProceedTypeName { get; set; }

        public string PaymentTypeName { get; set; }

        public decimal DueAmount { get; set; }

        public decimal TotalPayment { get; set; }

        public decimal OutstandingBalance { get; set; }

        public DateTime? PaymentEndDate { get; set; }

        public string LoanTypeDescription { get; set; }

        public string ContactNumbers { get; set; }

        public string Remarks { get; set; }
    }

    public class DailyDuePaymentItem
    {
        public int ScheduleID { get; set; }

        public int PaymentID { get; set; }

        public string DocumentNo { get; set; }

        public string BorrowerName { get; set; }

        public string PaymentFrequency { get; set; }

        public DateTime DueDate { get; set; }

        public decimal DueAmount { get; set; }

        public decimal AmountPaid { get; set; }

        public int PaymentTypeID { get; set; }

        public string PaymentTypeName { get; set; }

        public string ChequeDetails { get; set; }

        public string ContactNumbers { get; set; }

        public string DueRemarks { get; set; }
    }

    public class OtherDuePaymentItem : DailyDuePaymentItem
    { }

    public class ChequeClearingItem
    {
        public int ID { get; set; }

        public string BorrowerName { get; set; }

        public decimal Amount { get; set; }

        public decimal Penalty { get; set; }

        public DateTime DatePosted { get; set; }

        public int StatusID { get; set; }

        public string Status { get; set; }

        public string Remarks { get; set; }

        public bool IsSelected { get; set; }
    }

    public class AgingReportModel : SearchModel
    {
        [Display(Name ="From Date")]
        public DateTime FromDate { get; set; }

        [Display(Name = "To Date")]
        public DateTime ToDate { get; set; }

        public IEnumerable<SelectListItem> Days { get; set; }

        public int SelectedDays { get; set; }

        public List<AgingReportItem> AgingItems { get; set; }
    }

    public class AgingReportItem
    {
        [Display(Name = "Document No.")]
        public string DocumentNo { get; set; }

        [Display(Name = "Borrower")]
        public string BorrowerName { get; set; }

        [Display(Name = "Loan Amount")]
        public decimal LoanAmount { get; set; }

        [Display(Name = "Type of Loan")]
        public string LoanType { get; set; }
    }

}